#include "strategy.h"
#include "deck.h"
#include<iostream>
#include<string>
using namespace std;
int player_strategy(int d_card_1, int* rand1)
{
    	int value=0;
    	char p_card[10];
    	Deck deck1;
	p_card[0]=deck1.get_card(rand1[2]);
	p_card[1]=deck1.get_card(rand1[3]);
	cout << "\nPlayer card 1 >>" << p_card[0];
	cout << "\nPlayer card 2 >>" << p_card[1];
    	value = deck1.card_to_value(p_card[0]) + deck1.card_to_value(p_card[1]);

    	if(deck1.card_to_value(p_card[0]) == 11 || deck1.card_to_value(p_card[1]) == 11)
    	{
        if(value > 21)
            value -= 10;
    	}

    //strategy start here
    	if (value<=8) 
		{
		p_card[2]=deck1.get_card(rand1[4]);//player hit
		value=value + deck1.card_to_value(p_card[2]);
		}
	else if (d_card_1==2 && value ==12); 
    	else if (value>=17) value=value+0;//player stand
	return value;
}
